<template>
  <div>
    <el-card class="box-card" style="height:800px">
      <div slot="header" class="clearfix">
        <span>目标任务查重</span>
      </div>
      <el-input
        clearable
        style="width:20%;margin-right:20px;"
        v-model="serinput"
        placeholder="请输入目标任务"
      ></el-input>
      <el-button type="primary" @click="serClick">搜索</el-button>
      <el-button type="primary" @click="serClicktwo">查重</el-button>
      <el-scrollbar class="page-component__scroll" style="height:100%">
        <div style="height:630px;">
          <el-table :data="tableData" border style="width: 100%; margin-top:20px;" height="630px">
            <el-table-column prop="index" align="center" label="序号" width="80"></el-table-column>
            <el-table-column prop="targetName" label="目标任务"></el-table-column>
            <el-table-column prop="taskName" label="重点工作"></el-table-column>
            <!-- <el-table-column prop="departmentName" label="牵头部门"></el-table-column> -->
            <el-table-column label="一季度任务量" align="center">
              <el-table-column prop="oneQuarterNumber" label="任务量" width="120" align="center"></el-table-column>
              <el-table-column prop="oneQuarterDegree" label="实际完成量" align="center" width="120"></el-table-column>
            </el-table-column>
            <el-table-column label="二季度任务量" align="center">
              <el-table-column prop="twoQuarterNumber" label="任务量" align="center" width="120"></el-table-column>
              <el-table-column prop="twoQuarterDegree" label="实际完成量" align="center" width="120"></el-table-column>
            </el-table-column>
            <el-table-column prop="threeQuarterNumber" label="三季度任务量" align="center">
              <el-table-column prop="threeQuarterNumber" label="任务量" align="center" width="120"></el-table-column>
              <el-table-column prop="threeQuarterDegree" label="实际完成量" align="center" width="120"></el-table-column>
            </el-table-column>
            <el-table-column prop label="全年任务量" align="center">
              <el-table-column prop="allNumber" label="任务量" align="center" width="120"></el-table-column>
              <el-table-column prop="allDegree" label="实际完成量" align="center" width="120"></el-table-column>
            </el-table-column>
          </el-table>
        </div>
      </el-scrollbar>
    </el-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      serinput: "",
      tableData: [],
    };
  },
  mounted() {
    // this.gettasksList();
  },
  methods: {
    decimal(val) {
      let _val = val * 100;
      _val = _val.toFixed(2);
      return _val + "%";
    },
    serClick() {
      this.gettasksList();
    },
    serClicktwo() {
      this.$axios
        .post("distribution/repeat", 2)
        .then((res) => {
          if (res.code == 200) {
            this.tableData = res.data;
            this.tableData.forEach((item, index) => {
              item.index = index + 1;
            });
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    gettasksList() {
      this.$axios
        .post("distribution/repeatSubtasks", { targetName: this.serinput }, 2)
        .then((res) => {
          if (res.code == 200) {
            this.tableData = res.data;
            this.tableData.forEach((item, index) => {
              item.index = index + 1;
            });
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>
<style scoped></style>
